package com.guyu.app.common.biz.handler;

import com.guyu.plugin.oss.core.OssClient;
import com.guyu.plugin.oss.entity.UploadResult;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;

@Slf4j
@RequiredArgsConstructor
@Service
public class FileUploadHandler {

    private final OssClient ossClient;

    /**
     * 通用上传文件
     */
    public UploadResult upload(MultipartFile file) {
        return ossClient.upload(file);
    }

    /**
     * 上传文件到指定文件夹
     */
    public UploadResult upload(MultipartFile file, String dir) {
        return ossClient.upload(file, dir);
    }

    /**
     * 上传文件到指定文件夹
     */
    public UploadResult upload(MultipartFile file, String dir, String filename) {
        return ossClient.upload(file, dir, filename);
    }
}
